package com.wngbms.netty._03buf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;

public class Buf02 {

    public static void main(String[] args) {

        ByteBuf buf = Unpooled.copiedBuffer("helloworld", CharsetUtil.UTF_8);

        if (buf.hasArray()) {

            byte[] array = buf.array();

            System.out.println(new String(array, CharsetUtil.UTF_8));

            array[0] = (byte) 'a';

            Buf01.p(buf);
//            System.out.println(buf);
            System.out.println(buf.toString(CharsetUtil.UTF_8));
        }

    }

}
